package com.bush.mall.member.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.member.entity.IntegrationChangeHistoryEntity;
import com.bush.mall.member.service.IntegrationChangeHistoryService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 积分变化历史记录
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("integrationchangehistory")
@Api(tags = "积分变化历史记录管理" )
public class IntegrationChangeHistoryController {

    @Resource(name= IntegrationChangeHistoryService.BEAN_ID)
    private IntegrationChangeHistoryService integrationChangeHistoryService;

    /**
     * 分页查询积分变化历史记录列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询积分变化历史记录列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return integrationChangeHistoryService.queryForPage(current,size);
    }

    /**
     * 保存积分变化历史记录表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存积分变化历史记录表单")
    @PostMapping
    public Result saveIntegrationChangeHistory(@RequestBody IntegrationChangeHistoryEntity integrationChangeHistory){
        return integrationChangeHistoryService.saveIntegrationChangeHistory(integrationChangeHistory);
    }

    /**
     * 修改积分变化历史记录表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改积分变化历史记录表单")
    @PutMapping
    public Result updateIntegrationChangeHistory(@RequestBody IntegrationChangeHistoryEntity integrationChangeHistory){
        return integrationChangeHistoryService.updateIntegrationChangeHistory(integrationChangeHistory);
    }

    /**
     * 通过指定id删除积分变化历史记录
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除积分变化历史记录")
    @DeleteMapping
    public Result deleteIntegrationChangeHistory(Long id){
        return integrationChangeHistoryService.deleteIntegrationChangeHistory(id);
    }

}
